﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace KeyboardHookPro
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();

            listener.Start();

            listener.ScanerEvent += Listener_ScanerEvent;

            this.FormClosed += (sender, e) =>
            {
                listener.Stop();
            };
        }

        private ScanerHook listener = new ScanerHook();

        private void Listener_ScanerEvent(ScanerHook.ScanerCodes codes)
        {
            this.txt_Info.Text = codes.Result;
        }
        private void btn_FocusOn_Click(object sender, EventArgs e)
        {
            this.txt_Info.Focus();
        }

        private void btn_FocusOff_Click(object sender, EventArgs e)
        {
            this.Focus();
        }
    }
}
